<!DOCTYPE html>
<html lang="zh-CN"
      xmlns:th="http://www.thymeleaf.org"
      xmlns:sec="http://www.thymeleaf.org/extras/spring-security">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
  <link rel="stylesheet" href="https://cdn.staticfile.org/twitter-bootstrap/4.3.1/css/bootstrap.css">
  <script src="https://cdn.staticfile.org/jquery/3.2.1/jquery.js"></script>
  <script src="https://cdn.staticfile.org/popper.js/1.15.0/umd/popper.js"></script>
  <script src="https://cdn.staticfile.org/twitter-bootstrap/4.3.1/js/bootstrap.js"></script>
  <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
  <script src="https://cdn.jsdelivr.net/npm/axios/dist/axios.js"></script>

  <title>Title</title>
</head>
<body>

<!--<div th:fragment="logout" class="logout" sec:authorize="isAuthenticated()">-->
<!--  <h6>logged in user: <span sec:authentication="name"></span></h6>-->
<!--  <h6>roles: <span sec:authentication="principal.authorities"></span></h6>-->
<!--  <div>-->
<!--    <form action="#" th:action="@{/logout}" method="post">-->
<!--      <input type="submit" value="logout">-->
<!--    </form>-->
<!--  </div>-->
<!--</div>-->

<!--<div>-->
<!--  <h1>武林秘籍管理系统</h1>-->
<!--  <h3 th:if="${user} == 'anonymousUser'">欢迎访问, 游客请 <a th:href="@{/login}">登录</a></h3>-->
<!--  <h3 th:unless="${user} == 'anonymousUser'"><span th:text="${user.Username}"></span><span>, </span><a th:href="@{/logout}">退出</a></h3>-->
<!--  <p th:text="${msg}"></p>-->
<!--</div>-->

<div>
  <h1>武林秘籍管理系统</h1>
  <div sec:authorize="!isAuthenticated()">
    <h6>游客您好, 如果想查看武林秘籍, 请 <a th:href="@{/login}">登录</a></h6>
    <h6>游客您好, 如果想查看武林秘籍, 请 <a th:href="@{/userlogin}">userlogin</a></h6>
  </div>
  <div sec:authorize="isAuthenticated()">
    <h6>logged in user: <span sec:authentication="name" style="color: forestgreen"></span></h6>
    <h6>roles: <span sec:authentication="principal.authorities"></span></h6>
    <h6>principal: <span sec:authentication="principal"></span></h6>
    <form action="#" th:action="@{/logout}" method="post">
      <input type="submit" value="logout">
    </form>
  </div>
</div>

<hr>

<div>
  <h2>不要钱的武功秘籍</h2>
  <ul>
    <li><a th:href="@{/level1/1}">罗汉拳</a></li>
    <li><a th:href="@{/level1/2}">武当长拳</a></li>
    <li><a th:href="@{/level1/3}">全真剑法</a></li>
  </ul>
</div>

<div sec:authorize="hasRole('VIP1')">
  <h2>普通武功秘籍</h2>
  <ul>
    <li><a th:href="@{/level1/1}">罗汉拳</a></li>
    <li><a th:href="@{/level1/2}">武当长拳</a></li>
    <li><a th:href="@{/level1/3}">全真剑法</a></li>
  </ul>
</div>

<div sec:authorize="hasRole('VIP2')">
  <h2>高级武功秘籍</h2>
  <ul>
    <li><a th:href="@{/level2/1}">太极拳</a></li>
    <li><a th:href="@{/level2/2}">七伤拳</a></li>
    <li><a th:href="@{/level2/3}">梯云纵</a></li>
  </ul>
</div>

<div sec:authorize="hasRole('VIP3')">
  <h2>绝世武功秘籍</h2>
  <ul>
    <li><a th:href="@{/level3/1}">葵花宝典</a></li>
    <li><a th:href="@{/level3/2}">龟派气功</a></li>
    <li><a th:href="@{/level3/3}">独孤九剑</a></li>
  </ul>
</div>

</body>
</html>
